package org.ithasu.uBroadcast.test;

import org.ithasu.uBroadcast.UMessage;
import org.ithasu.uBroadcast.connectors.UDPConnector;

public class LostPacketSend {

	public static void main(String[] args) {
		try {
			UMessage m = new UMessage();
			m.add("Roger that !");
			m.setType((byte) 0);

			UDPConnector conn = new UDPConnector("losttx".getBytes(),
					UDPConnector.DEFAULT_PORT, 0);
			int nb_sent = 0;
			while (true) {
				conn.send(m);
				m.setType((byte) ((m.getType() + 1)));
				nb_sent++;
				try {
					Thread.sleep(200);
				} catch (Exception e) {
					// pass
				}
				System.out.println(nb_sent + " message(s) sent");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
